<?php
	class Property extends Controller 
	{
		function Property()
		{
			//error_reporting(0);
			parent::Controller();
			$this->load->model('property_model');
		}
		function index()
		{
			$data['propertytype']=$this->property_model->fetchpropertytype();
			$data['citylist']=$this->property_model->fetchcitylist();
			$data['minbudget']=$this->property_model->fetchpropertyminbudget();
			$data['maxbudget']=$this->property_model->fetchpropertymaxbudget();
			$this->load->view('layout/header.php');
			$this->load->view('layout/topmenu.php');
			$this->load->view('search/searchview.php',$data);
			$this->load->view('layout/bodyview.php');
			$this->load->view('layout/footer.php');
			
		}
		
		function propertysearch()
		{
			if(isset($_POST['submit']))
			{
				if(empty($_POST['location'])||empty($_POST['minprice'])||empty($_POST['maxprice'])||empty($_POST['propertytype']))
				{
					$this->session->set_userdata('errmsg','Message : Select all mandatory fields first.');
					redirect(WEB_URL . 'property/propertysearch');
				}
				else
				{
					$propertytype=strtolower($_POST['propertytype']);
					if($propertytype=='residential')
					{
						print $propertytype;
					}
					elseif($propertytype=='commercial')
					{
						print $propertytype;
					}
					
				}
			}
			$data['propertytype']=$this->property_model->fetchpropertytype();
			$data['citylist']=$this->property_model->fetchcitylist();
			$data['minbudget']=$this->property_model->fetchpropertyminbudget();
			$data['maxbudget']=$this->property_model->fetchpropertymaxbudget();
			$this->load->view('layout/header.php');
			$this->load->view('layout/topmenu.php');
			$this->load->view('search/searchview.php',$data);
			//$this->load->view('search/propertysearchresult.php',$data);
			$this->load->view('layout/footer.php');
		}
		
	}
		
?>